<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="pageB">点击发送</button>
    <script>
        // 在页面 A 中发送消息给页面 B
        const targetWindow = document.querySelector('#pageB').contentWindow;
        const message = 'Hello Page B!';
        
        targetWindow.postMessage(message, 'http://localhost:5500');
    </script>
</body>

</html>